package com.che.libcommon.ui;

import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;

import com.che.common.libcommon.R;

/**
 * Created by zl on 2017/12/21.
 */

public class VOMessage {

  public static final int TYPE_NO_NETWORK = 1;
  public static final int TYPE_NETWORK_ERROR = 2;
  public static final int TYPE_EMPTY_DATA = 3;

  public static VOMessage create(Throwable throwable){
    VOMessage message=new VOMessage();
    message.type=TYPE_NETWORK_ERROR;
    message.titleRes= R.string.error_common;
    message.btnRes=R.string.click_refresh;
    return message;
  }

  public static VOMessage createEmpty(@DrawableRes int drawableRes,@StringRes int titleRes,@StringRes int btnRes){

    return createEmpty(drawableRes,titleRes,0,btnRes);
  }

  public static VOMessage createEmpty(@DrawableRes int drawableRes,@StringRes int titleRes,@StringRes int describeRes,@StringRes int btnRes){
    VOMessage voMessage = new VOMessage();
    voMessage.type = TYPE_EMPTY_DATA;
    voMessage.drawableRes = drawableRes;
    voMessage.titleRes = titleRes;
    voMessage.btnRes = btnRes;
    voMessage.describeRes = describeRes;
    return voMessage;
  }

  public int type;

  public @DrawableRes int drawableRes;
  public @StringRes int titleRes;
  public @StringRes int describeRes;

  public @StringRes int btnRes;

}
